/**
 *====================================================
 * 文件名称: AbnormalEquipmentEntity.java
 * 修订记录：
 * No    日期				作者(操作:具体内容)
 * 1.    2015年11月21日			chenxy(创建:创建文件)
 *====================================================
 * 类描述：(说明未实现或其它不应生成javadoc的内容)
 */
package com.yuexunit.finance.project.entity;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.yuexunit.finance.project.AuthenticatEntity;
import com.yuexunit.finance.project.AbnormalExpenseSource;
import com.yuexunit.finance.project.entity.lexicon.AbnormalSourceEnum;
import com.yuexunit.finance.project.entity.lexicon.ExpenditureEnum;
import com.yuexunit.finance.project.entity.lexicon.OperatorRoleEnum;

/**
 * @ClassName: AbnormalEquipmentEntity
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author chenxy
 * @date 2015年11月21日 下午1:11:46
 */
@Entity
@Table(name = "FIN_ABNORMAL_EQUIPMENT")
public class AbnormalEquipmentEntity extends AuthenticatEntity implements AbnormalExpenseSource {

	/** 异常设备ID */
	@Id
	@GeneratedValue
	@Column(name = "ABNORMAL_EQUIPMENT_ID")
	private Long abnormalEquipmentId;

	/** 异常ID */
	@Column(name = "ABNORMAL_ID")
	private Long abnormalId;

	/** 设备编号 */
	@Column(name = "SERIAL_NUMBER")
	private String serialNumber;

	/** 设备名称 */
	@Column(name = "EQUIPMENT_NAME")
	private String equipmentName;

	/** 设备类别 0:未知/1:内部设备/2:供应商(物流)/3:客户(企业)/4:其他 */
	@Column(name = "MOLD")
	private Integer mold;

	/** 所属公司租户ID */
	@Column(name = "COMPANY_TENANT_ID")
	private Long companyTenantId;

	/** 所属公司ID 1:内部设备则为平台/2:供应商则为物流公司/3:客户则为企业 */
	@Column(name = "COMPANY_ID")
	private Long companyId;

	/** 所属公司 */
	@Column(name = "COMPANY")
	private String company;

	/** 是否赔款 */
	@Column(name = "INDEMNITY")
	private Boolean indemnity;

	/** 损坏性质 0:未知/31:报废/32:维修/33:赔偿 */
	@Column(name = "NATURE")
	private Integer nature;

	/** 损害情况(货品/设备) */
	@Column(name = "DAMAGE")
	private String damage;

	/** 赔偿金额 */
	@Column(name = "ABNORMAL_AMOUNT")
	private BigDecimal abnormalAmount;

	/** 收支类型 0:未知/1:付款单/2:收款单 */
	@Column(name = "EXPENDITURE")
	private ExpenditureEnum expenditure;

	/** 费用单据 */
	@Column(name = "VOUCHER")
	private String voucher;

	/** 备注 */
	@Column(name = "REMARK")
	private String remark;

	public Long getAbnormalEquipmentId() {
		return abnormalEquipmentId;
	}

	public void setAbnormalEquipmentId(Long abnormalEquipmentId) {
		this.abnormalEquipmentId = abnormalEquipmentId;
	}

	public Long getAbnormalId() {
		return abnormalId;
	}

	public void setAbnormalId(Long abnormalId) {
		this.abnormalId = abnormalId;
	}

	public String getSerialNumber() {
		return serialNumber;
	}

	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}

	public String getEquipmentName() {
		return equipmentName;
	}

	public void setEquipmentName(String equipmentName) {
		this.equipmentName = equipmentName;
	}

	public Integer getMold() {
		return mold;
	}

	public void setMold(Integer mold) {
		this.mold = mold;
	}

	public Long getCompanyTenantId() {
		return companyTenantId;
	}

	public void setCompanyTenantId(Long companyTenantId) {
		this.companyTenantId = companyTenantId;
	}

	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public Boolean getIndemnity() {
		return indemnity;
	}

	public void setIndemnity(Boolean indemnity) {
		this.indemnity = indemnity;
	}

	public Integer getNature() {
		return nature;
	}

	public void setNature(Integer nature) {
		this.nature = nature;
	}

	public String getDamage() {
		return damage;
	}

	public void setDamage(String damage) {
		this.damage = damage;
	}

	public BigDecimal getAbnormalAmount() {
		return abnormalAmount;
	}

	public void setAbnormalAmount(BigDecimal abnormalAmount) {
		this.abnormalAmount = abnormalAmount;
	}

	public ExpenditureEnum getExpenditure() {
		return expenditure;
	}

	public void setExpenditure(ExpenditureEnum expenditure) {
		this.expenditure = expenditure;
	}

	public String getVoucher() {
		return voucher;
	}

	public void setVoucher(String voucher) {
		this.voucher = voucher;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public AbnormalSourceEnum getAbnormalSource() {
		return AbnormalSourceEnum.EQUIPMENT;
	}

	@Override
	public Long getAbnormalSourceId() {
		return this.abnormalEquipmentId;
	}

	@Override
	public OperatorRoleEnum getReceiptType() {
		if (ExpenditureEnum.RECIEVEMENT != this.expenditure) {
			return null;
		}
		return OperatorRoleEnum.valueOf(this.mold);
	}

	@Override
	public Long getReceiptId() {
		if (ExpenditureEnum.RECIEVEMENT != this.expenditure) {
			return null;
		}
		return this.companyId;
	}

	@Override
	public Long getReceiptTenantId() {
		if (ExpenditureEnum.RECIEVEMENT != this.expenditure) {
			return null;
		}
		return this.companyTenantId;
	}

	@Override
	public String getReceiptName() {
		if (ExpenditureEnum.RECIEVEMENT != this.expenditure) {
			return null;
		}
		return this.company;
	}

	@Override
	public OperatorRoleEnum getDisbursementType() {
		if (ExpenditureEnum.PAYMENT != this.expenditure) {
			return null;
		}
		return OperatorRoleEnum.valueOf(this.mold);
	}

	@Override
	public Long getDisbursementId() {
		if (ExpenditureEnum.PAYMENT != this.expenditure) {
			return null;
		}
		return this.companyId;
	}

	@Override
	public Long getDisbursementTenantId() {
		if (ExpenditureEnum.PAYMENT != this.expenditure) {
			return null;
		}
		return this.companyTenantId;
	}

	@Override
	public String getDisbursementName() {
		if (ExpenditureEnum.PAYMENT != this.expenditure) {
			return null;
		}
		return this.company;
	}

}